<template>  
  <div class="register">  
    <h2>Register</h2>  
    <form @submit.prevent="register">  
      <div>  
        <label for="username">用户名:</label>  
        <input type="text" v-model="username" required />  
      </div>  
      <div>  
        <label for="password">密码:</label>  
        <input type="password" v-model="password" required />  
      </div>  
      <button type="submit">注册</button>  
    </form>  
  </div>  
</template>  
  
<script>  
export default {  
  data() {  
    return {  
      username: '',  
      password: ''  
    };  
  },  
  methods: {  
    register() {  
      // 这里可以使用Vuex或API进行实际的注册  
      // 这里简单模拟  
      alert('User registered successfully');  
      this.$router.push({ name: 'Login' });  
    }  
  }  
};  
</script>  
  
<style scoped>  
.register {  
  max-width: 300px;  
  margin: 0 auto;  
}  
</style>